package com.example.demo.auth.service.impl;

import com.example.demo.auth.service.SysCaptchaService;
import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.awt.image.BufferedImage;

@Service
public class SysCaptchaServiceImpL  implements SysCaptchaService {

    @Autowired
    Producer producer;
    @Override
    public BufferedImage getCaptcha(String uuid) {

        //生成文字验证码
        String code = producer.createText();
        // 存进redis,5分钟后过期
//        redisUtils.set(genRedisKey(uuid),code,CAPTCHA_EXPIRE);

        return producer.createImage(code);
    }

    @Override
    public boolean validate(String uuid, String code) {
        return false;
    }
}
